import { stringify } from 'qs';
import request from '@/utils/request';

export async function fetch(params) {
  return request(`${API_PREFIX}/banners?${stringify(params)}`);
}

export async function add(body) {
  return request(`${API_PREFIX}/banners`, {
    method: 'POST',
    body,
  });
}

// 删除广告
export async function remove({ id, ...body }) {
  return request(`${API_PREFIX}/banners/${id}`, {
    method: 'DELETE',
    body,
  });
}

// 下架广告
export async function update({ id, ...body }) {
  return request(`${API_PREFIX}/banners/${id}`, {
    method: 'PUT',
    body,
  });
}